package cn.mong.util.modelexcel;

import java.util.Arrays;
import java.util.List;

/**
 *  把模型转换成单元格列表
 * @author mengxianming@2021-9-16 10:46:00
 *
 */
@FunctionalInterface
public interface ModelToCellsConverter<D>{
    /**
     * 模型转换成正文单元格列表
     * @param model
     * @return
     */
    List<? extends PositionCell> modelToValCells(D model);

    public static ModelToCellsConverter<?> getDefault() {
        return DefaultModelToCellsConverter.getInstance();
    }

    public static class DefaultModelToCellsConverter implements ModelToCellsConverter<Object>{
        private static final DefaultModelToCellsConverter instance = new DefaultModelToCellsConverter();


        public static DefaultModelToCellsConverter getInstance() {
            return instance;
        }


        @Override
        public List<? extends PositionCell> modelToValCells(Object model) {
            return Arrays.asList(new PositionCell(0, 0, model, 1, 1, 15));
        }

    }

}